import Vue from 'vue'
import VueRouter from 'vue-router'
import ScoreAnalysis from '@/views/score/ScoreAnalysis.vue'
import GradeScoreAnalysis from '@/views/score/gradeScoreAnalysis.vue'
import SinglegradeScoreanalysis from '@/views/score/singlegradeScoreanalysis.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/score-analysis'
  },
  {
    path: '/score-analysis',
    name: 'ScoreAnalysis',
    component: ScoreAnalysis,
    meta: {
      title: '成绩分析'
    }
  },
  {
    path: '/gradeScoreAnalysis',
    name: 'GradeScoreAnalysis',
    component: GradeScoreAnalysis,
    meta: {
      title: '成绩分析'
    }
  },
  {
    path: '/singlegradeScoreanalysis',
    name: 'SinglegradeScoreanalysis',
    component: SinglegradeScoreanalysis,
    meta: {
      title: '成绩分析'
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

// 路由标题
router.beforeEach((to, from, next) => {
  document.title = to.meta.title || '成绩分析系统'
  next()
})

export default router 